﻿<%@ Page Title="Quản lý đề thi con" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="frmTaoDeIn.aspx.cs" Inherits="Admin_frmTaoDeIn" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="wrap">
        <h2>
            Quản lý đề thi con|
            <asp:HyperLink ID="HyperLink1" runat="server" CssClass="node"
            NavigateUrl="~/Admin/frmAdTaoDeThi.aspx" BackColor="#F1F1F2" >Quản lý đề thi</asp:HyperLink>
            |
                       
        </h2>
    </div>
    <div style="clear: both;">&nbsp;</div>

    <div class="wrap" style="border: solid 1px #CCCCCC;">
    <table style="width: 100%">
        <tr>
            <td>
                <asp:Label ID="Label3" runat="server" Text="Tên Đề Thi"></asp:Label>
            </td>
            <td>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:DropDownList ID="drlTenDT" runat="server" 
                    DataSourceID="LinqDataSource1" DataTextField="TenDeThi" DataValueField="MaDT" AutoPostBack="True" Height="25px" Width="267px">
                        </asp:DropDownList>
                        <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                    ContextTypeName="DataClassesDataContext" Select="new (MaDT, TenDeThi)" 
                    TableName="tbl_DETHIs">
                        </asp:LinqDataSource>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Label4" runat="server" Text="Chi Tiết Đề Thi"></asp:Label>
            </td>
            <td>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource2" 
                    Height="50px" Width="263px" AutoGenerateRows="False">
                            <EditRowStyle CssClass="yEditRowStyle" />
                            <RowStyle CssClass="yRowStyle" />
                            <Fields>
                                <asp:BoundField DataField="MaDT" HeaderText="Mã Đề Thi">
                                <HeaderStyle Width="100px" />
                                </asp:BoundField>
                                <asp:BoundField DataField="MaQT" HeaderText="Mã Quy Tắc" />
                                <asp:BoundField DataField="TenDeThi" HeaderText="Tên Đề Thi" />
                                <asp:BoundField DataField="TenMonHoc" HeaderText="Tên Môn" />
                                <asp:BoundField DataField="MsLopTC" HeaderText="Mã Lớp TC" />
                                <asp:BoundField DataField="NgayApDung" HeaderText="Ngày Áp Dụng" 
                                    DataFormatString="{0:d/M/yyyy}" />
                            </Fields>
                            <HeaderStyle CssClass="yHeaderStyle" />
                            <PagerStyle CssClass="yPagerStyle" />
                            <AlternatingRowStyle CssClass="yAltRowStyle" />
                        </asp:DetailsView>
                        <asp:HiddenField ID="HiddenField1" runat="server" />
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:TracNghiemTrucTuyenConnectionString %>" 
                            SelectCommand="SELECT tbl_DETHI.MaDT, tbl_DETHI.MaQT, tbl_DETHI.TenDeThi, tbl_MONHOC.TenMonHoc, tbl_DETHI.MsLopTC, tbl_DETHI.NgayApDung FROM tbl_MONHOC INNER JOIN tbl_LOPTC ON tbl_MONHOC.MsMonHoc = tbl_LOPTC.MsMonHoc INNER JOIN tbl_DETHI ON tbl_LOPTC.MsLopTC = tbl_DETHI.MsLopTC WHERE ([MaDT] = @MaDT)">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="drlTenDT" Name="MaDT" 
                            PropertyName="SelectedValue" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                    <ContentTemplate>
                        <asp:Button ID="btnTaoDeIn" runat="server" onclick="btnTaoDeIn_Click" CssClass="button_cua_tao" Text="Tạo Đề In" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                    
                   <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                       <ContentTemplate>
                           <asp:DropDownList ID="drlDecon" runat="server" 
    AutoPostBack="True" DataSourceID="LinqDataSource2" DataTextField="MaDC" 
    DataValueField="MaDC" Height="20px" Width="117px">
                           </asp:DropDownList>
                           <asp:Button ID="btnIn" runat="server" onclick="btnIn_Click" Text="In đề thi" CssClass="button_cua_tao"  />
                           <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
    ContextTypeName="DataClassesDataContext" Select="new (MaDC)" 
    TableName="tbl_DECONs" Where="MaDT == @MaDT">
                               <WhereParameters>
                                   <asp:ControlParameter ControlID="drlTenDT" Name="MaDT" 
                                       PropertyName="SelectedValue" Type="String" />
                               </WhereParameters>
                           </asp:LinqDataSource>
                       </ContentTemplate>
                   </asp:UpdatePanel>
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
   </div>
   <script type="text/javascript">
   function xacnhan(){
   if (
               ($.trim($("#<%=drlTenDT.ClientID %>").val()) == 0)) {
                alert("Thông báo! Chưa có đề thi nào!");
                return false;

            }
   else{         
   var kt=confirm("Sau khi đã tạo đề con sẽ không thể thay đổi đề gốc được nữa, bạn có tiếp tục không?")
   
   if(kt){
   return true;
   }
   else{
   return false;
   }
   }
   }
   </script>
</asp:Content>

